package edu.ynu.se.xiecheng.achitectureclass.service;

import edu.ynu.se.xiecheng.achitectureclass.common.service.LogicService;
import edu.ynu.se.xiecheng.achitectureclass.dao.LineItemDao;
import edu.ynu.se.xiecheng.achitectureclass.dao.OorderDao;
import edu.ynu.se.xiecheng.achitectureclass.entity.Item;
import edu.ynu.se.xiecheng.achitectureclass.entity.LineItem;
import edu.ynu.se.xiecheng.achitectureclass.entity.Oorder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class LineItemService extends LogicService<LineItemDao, LineItem,Long> {
    @Resource
    private LineItemDao lineItemDao;
    @Resource
    private OorderDao oorderDao;
    public LineItemService(@Autowired LineItemDao dao) {
        super(dao);
    }
    public List<LineItem> browseLineItem(Long orderId) {
        Oorder oorder = oorderDao.getReferenceById(orderId);
        return lineItemDao.findAllByOorder(oorder);
    }

}
